//
//  MyMessage.m
//  MINFOBBS
//
//  Created by juvid on 13-12-9.
//  Copyright (c) 2013年 minfo. All rights reserved.
//

#import "MyMessage.h"
#import "DetectionSystemVersion.h"
#import "HistoryMessage.h"
@interface MyMessage ()

@end

@implementation MyMessage

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    if ([[DetectionSystemVersion alloc]Version]) {
        self.edgesForExtendedLayout=UIRectEdgeNone;
    }
    [self BackButton];
    self.view.backgroundColor=[UIColor colorWithRed:243/255.0 green:243/255.0 blue:243/255.0 alpha:1];
    self.table.layer.cornerRadius=8.0;
    // Do any additional setup after loading the view from its nib.
}
-(void)BackButton{
    self.navigationItem.titleView=[DetectionSystemVersion SetBarTitle:@"百事搜"];
    [self.navigationItem setHidesBackButton:YES];
    UIButton *btnBack=[[DetectionSystemVersion alloc]BackButton];
    [btnBack addTarget:self action:@selector(BackReturn:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc]initWithCustomView:btnBack];
    self.navigationItem.leftBarButtonItem=backItem;
    
}
#pragma mark 导航栏按钮事件
-(void)BackReturn:(id)sender{
    //    [self.navigationController.view removeFromSuperview];
    [self HidePick:self.navigationController.view];
    [self.navigationController removeFromParentViewController];
}
#pragma mark 动画
-(void)HidePick:(UIView *)vieBounced {
    [UIView animateWithDuration:0.3
                     animations:^(void) {
                         vieBounced.alpha = 0.0;
                         //                         vieBounced.frame = CGRectMake(0, self.view.frame.size.height, 104, (self.view.frame.size.height-117-8)/3);
                     } completion:^(BOOL finished) {
                         
                         [vieBounced removeFromSuperview];
                     }];
    
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    //#warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    //#warning Incomplete method implementation.
    // Return the number of rows in the section.
    return 2;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        //        cell.backgroundColor=[UIColor grayColor];
    }
     cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    //    cell.accessoryView=lab;
       if (indexPath.row==0) {
        [cell.textLabel setText:@"应用推送"];
    }
    else{
        [cell.textLabel setText:@"意见反馈"];

    }
    cell.textLabel.font=[UIFont systemFontOfSize:15];
    return cell;
}
-(float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    HistoryMessage *historyMes=[[HistoryMessage alloc]init];
    if (indexPath.row==1) {
        historyMes.isFeed=YES;
    }
    [self.navigationController pushViewController:historyMes animated:YES];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
